<div class="form">
    <?php $form=$this->beginWidget('CActiveForm',array(
        'id'=>'schedule-form',
        
    ));?>
    <?php echo $form->errorSummary($model); ?>
    <?php echo $form->hiddenField($model,'empno');?>
    <div class="row">
        <?php echo $form->labelEx($model,'shift');?>
        <?php echo $form->dropDownList($model,'shift',$model->getShiftList(), array('onchange'=>'changeShift(this);'));?>
        <?php echo $form->error($model,'shift');?>
    </div>
    
    <div class="row start">
        <?php echo $form->labelEx($model,'MonStart');?>
        <?php $this->widget('CMaskedTextField',array(
            'model'=>$model,
            'attribute'=>'MonStart',
            'mask'=>'99:99:99',
            'htmlOptions'=>array(
                'size'=>6
            )
        ));?>
        <?php $form->error($model,'MonStart');?>
    </div>
    <div class="row end">
        <?php echo $form->labelEx($model,'MonEnd');?>
        <?php $this->widget('CMaskedTextField',array(
            'model'=>$model,
            'attribute'=>'MonEnd',
            'mask'=>'99:99:99',
            'htmlOptions'=>array(
                'size'=>6
            )
        ));?>
        <?php $form->error($model,'MonEnd');?>
    </div>
    <div class="row start">
        <?php echo $form->labelEx($model,'TueStart');?>
        <?php $this->widget('CMaskedTextField',array(
            'model'=>$model,
            'attribute'=>'TueStart',
            'mask'=>'99:99:99',
            'htmlOptions'=>array(
                'size'=>6
            )
        ));?>
        <?php $form->error($model,'TueStart');?>
    </div>
    <div class="row end">
        <?php echo $form->labelEx($model,'TueEnd');?>
        <?php $this->widget('CMaskedTextField',array(
            'model'=>$model,
            'attribute'=>'TueEnd',
            'mask'=>'99:99:99',
            'htmlOptions'=>array(
                'size'=>6
            )
        ));?>
        <?php $form->error($model,'TueEnd');?>
    </div>
    
    <div class="row start">
        <?php echo $form->labelEx($model,'WedStat');?>
        <?php $this->widget('CMaskedTextField',array(
            'model'=>$model,
            'attribute'=>'WedStart',
            'mask'=>'99:99:99',
            'htmlOptions'=>array(
                'size'=>6
            )
        ));?>
        <?php $form->error($model,'WedStart');?>
    </div>
    
    <div class="row end">
        <?php echo $form->labelEx($model,'WedEnd');?>
        <?php $this->widget('CMaskedTextField',array(
            'model'=>$model,
            'attribute'=>'WedEnd',
            'mask'=>'99:99:99',
            'htmlOptions'=>array(
                'size'=>6
            )
        ));?>
        <?php $form->error($model,'WedEnd');?>
    </div>
    
    <div class="row start">
        <?php echo $form->labelEx($model,'ThuStart');?>
        <?php $this->widget('CMaskedTextField',array(
            'model'=>$model,
            'attribute'=>'ThuStart',
            'mask'=>'99:99:99',
            'htmlOptions'=>array(
                'size'=>6
            )
        ));?>
        <?php $form->error($model,'ThuStart');?>
    </div>
    
    <div class="row end">
        <?php echo $form->labelEx($model,'ThuEnd');?>
        <?php $this->widget('CMaskedTextField',array(
            'model'=>$model,
            'attribute'=>'ThuEnd',
            'mask'=>'99:99:99',
            'htmlOptions'=>array(
                'size'=>6
            )
        ));?>
        <?php $form->error($model,'ThuEnd');?>
    </div>
    
    <div class="row start">
        <?php echo $form->labelEx($model,'FriStart');?>
        <?php $this->widget('CMaskedTextField',array(
            'model'=>$model,
            'attribute'=>'FriStart',
            'mask'=>'99:99:99',
            'htmlOptions'=>array(
                'size'=>6
            )
        ));?>
        <?php $form->error($model,'FriStart');?>
    </div>
    
    <div class="row end">
        <?php echo $form->labelEx($model,'FriEnd');?>
        <?php $this->widget('CMaskedTextField',array(
            'model'=>$model,
            'attribute'=>'FriEnd',
            'mask'=>'99:99:99',
            'htmlOptions'=>array(
                'size'=>6
            )
        ));?>
        <?php $form->error($model,'FriEnd');?>
    </div>
    
    <div class="row">
        <?php echo $form->labelEx($model,'SatStart');?>
        <?php $this->widget('CMaskedTextField',array(
            'model'=>$model,
            'attribute'=>'SatStart',
            'mask'=>'99:99:99',
            'htmlOptions'=>array(
                'size'=>6
            )
        ));?>
        <?php $form->error($model,'SatStart');?>
    </div>
    
    <div class="row">
        <?php echo $form->labelEx($model,'SatEnd');?>
        <?php $this->widget('CMaskedTextField',array(
            'model'=>$model,
            'attribute'=>'SatEnd',
            'mask'=>'99:99:99',
            'htmlOptions'=>array(
                'size'=>6
            )
        ));?>
        <?php $form->error($model,'SatEnd');?>
    </div>
    
    <div class="row">
        <?php echo $form->labelEx($model,'SunStart');?>
        <?php $this->widget('CMaskedTextField',array(
            'model'=>$model,
            'attribute'=>'SunStart',
            'mask'=>'99:99:99',
            'htmlOptions'=>array(
                'size'=>6
            )
        ));?>
        <?php $form->error($model,'SunStart');?>
    </div>
    
    <div class="row">
        <?php echo $form->labelEx($model,'SunEnd');?>
        <?php $this->widget('CMaskedTextField',array(
            'model'=>$model,
            'attribute'=>'SunEnd',
            'mask'=>'99:99:99',
            'htmlOptions'=>array(
                'size'=>6
            )
        ));?>
        <?php $form->error($model,'SunEnd');?>
    </div>
    <?php /*<div class="row_buttons">
        <?php echo CHtml::submitButton('Save');?>
    </div>*/?>
    <?php $this->endWidget()?>
</div>
<script type="text/javascript">
function changeShift(obj){
    var shift = $(obj).val();
    
    $.ajax({
        type: 'POST',
        url: 'index.php?r=Employees/shiftTime',
        data: {shift_num: shift},
        success: function(data){
            var shift_val = data.split(',');
            $('.start').each(function(){
                $('.start input').val(shift_val[0]);
            });
            $('.end').each(function(){
                $('.end input').val(shift_val[1]);
            });
        }
      
    });
}
</script>